<?php

namespace Home\Controller;

use Think\Controller;

class ApiController extends Controller {
    
    public $key = 'GJ9ASD0kjshfdgGA78ATAFDkln841321'; //通信KEY
    public $userinfo = array();                            //用户信息


    /**
     * 创建宴会
     */
    public function creat_banquet() {
        $data = $_POST['data'];
        $key = $_POST['key'];
        
        $returnData = array();
		$mkkey = md5($_POST['data'] . $this->key);
		if ($mkkey != $key) {
			$returnData['state'] = 0;
			$returnData['message'] = '非法请求';
			echo json_encode($returnData);
			exit;
		} else {
			$BanquetModel = M('Banquet');
			$wx_id = $this->userinfo['wx_id'];
            //插入主表 begin
            $saveData = array();
            $saveData['	name'] = $wx_id;
            $saveData['creat_user'] = $wx_id;
            $saveData['add_time'] = \Org\Net\Fun::now_time();
            $res = $BanquetModel->add($saveData);
            //插入主表 end
            
            //插入附表 begin
            $inserNameArr = ['主彬桌','亲人桌','好友桌','同事桌',''];
            //插入附表 end
            
            
            
            
            
            $returnData['state'] = 1;
				$returnData['message'] = '查询成功';
				$returnData['data'] = $infomation;
			echo json_encode($returnData);
			exit;
		}
    }

}
